package com.xiaoyang.forum.controller;


import com.xiaoyang.forum.common.code.Result;
import com.xiaoyang.forum.domain.vo.BoardVO;
import com.xiaoyang.forum.service.IBoardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author XiaoYang
 * @since 2025-08-13
 */
@Slf4j
@RestController
@RequestMapping("/board")
public class BoardController {

    @Autowired
    private IBoardService boardService;

    @Value("${forum.index.board-num:9}")
    private Integer indexBoardNum;

    /**
     * 版块列表
     * @return
     */
    @GetMapping("/semiLogin/toList")
    public Result<List<BoardVO>> toList() {
        log.info("获取版块列表");
        return Result.success(boardService.selectByNum(indexBoardNum));
    }
}
